package com.yunlc.kubernetes.traefik.models;

import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class TraefikV1alpha1ServiceWeighted {

    @SerializedName("services")
    private List<TraefikV1alpha1ServiceWeightedService> services = null;

    public TraefikV1alpha1ServiceWeighted services(List<TraefikV1alpha1ServiceWeightedService> services) {
        this.services = services;
        return this;
    }

    public TraefikV1alpha1ServiceWeighted addServiceItem(TraefikV1alpha1ServiceWeightedService serviceItem) {
        if (this.services == null) {
            this.services = new ArrayList<TraefikV1alpha1ServiceWeightedService>();
        }
        this.services.add(serviceItem);
        return this;
    }

    @ApiModelProperty(value = "services")
    public List<TraefikV1alpha1ServiceWeightedService> getServices() {
        return services;
    }

    public void setServices(List<TraefikV1alpha1ServiceWeightedService> services) {
        this.services = services;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TraefikV1alpha1ServiceWeighted serviceWeighted = (TraefikV1alpha1ServiceWeighted) o;
        return Objects.equals(this.services, serviceWeighted.services);
    }

    @Override
    public int hashCode() {
        return Objects.hash( services);
    }


    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class TraefikV1alpha1ServiceWeighted {\n");

        sb.append("    services: ").append(toIndentedString(services)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

}
